package com.fili;

import java.awt.*;

/**
 * Created by Claudiu-Florin FILIMON
 * Date: Mar 2, 2007
 * Time: 1:11:18 PM
 * Revision: 0
 */
public class Broasca
{
    private int x, y;
    private int orX, orY;


    public int getX()
    {
        return x;
    }

    public int getY()
    {
        return y;
    }


    public int getOrY()
    {
        return orY;
    }

    public int getOrX()
    {
        return orX;
    }

    public Broasca(int x, int y)
    {
        this.x = x;
        this.y = y;
    }

    public void setOrientation(int orX, int orY)
    {
        this.orX = orX;
        this.orY = orY;
    }

    public Point getPlus(float radius)
    {
        int dx = orX - x;
        int dy = orY - y;
        float len = (float) Math.sqrt(dx * dx + dy * dy);

        return new Point( (int) (x + dx * radius / len), (int) (y + dy * radius / len));
    }
    public void paint(Graphics g)
    {
        g.setColor(Color.green);
        g.fillOval(x - 20, y - 20, 41, 41);
        g.setColor(Color.black);
        g.drawOval(x - 20, y - 20, 40, 40);

        Point p = getPlus(30);
        g.drawLine(x, y, p.x,p.y);
    }
}
